From 37201c620379d3afdaafd85009312b17ab9842c3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roger=20Pau=20Monn=C3=A9?= Date: Thu, 5 Jun 2014 17:41:46 +0200 Subject: [PATCH] make logdirty and iommu mutually exclusive MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Prevent the usage of global logdirty if the domain is using the IOMMU, and also prevent passthrough of devices if logdirty is enabled. Signed-off-by: Roger Pau Monné Acked-by: Jan Beulich Acked-by: Tim Deegan --- xen/arch/x86/mm/paging.c | 9 +++++++++ xen/drivers/passthrough/pci.c | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/xen/arch/x86/mm/paging.c b/xen/arch/x86/mm/paging.c index 9e9a11b561..32764ba86d 100644 --- a/xen/arch/x86/mm/paging.c +++ b/xen/arch/x86/mm/paging.c @@ -168,6 +168,15 @@ int paging_log_dirty_enable(struct domain *d, bool_t log_global) { int ret; + if ( need_iommu(d) && log_global ) + { + /* + * Refuse to turn on global log-dirty mode + * if the domain is using the IOMMU. + */ + return -EINVAL; + } + if ( paging_mode_log_dirty(d) ) return -EINVAL; diff --git a/xen/drivers/passthrough/pci.c b/xen/drivers/passthrough/pci.c index b7f6e8ac1a..43c1a81f91 100644 --- a/xen/drivers/passthrough/pci.c +++ b/xen/drivers/passthrough/pci.c @@ -1233,7 +1233,8 @@ static int assign_device(struct domain *d, u16 seg, u8 bus, u8 devfn) * enabled for this domain */ if ( unlikely(!need_iommu(d) && (d->arch.hvm_domain.mem_sharing_enabled || - d->mem_event->paging.ring_page)) ) + d->mem_event->paging.ring_page || + p2m_get_hostp2m(d)->global_logdirty)) ) return -EXDEV; if ( !spin_trylock(&pcidevs_lock) ) -- 2.30.2